//
//  BaseBackViewController.m
//  customer
//
//  Created by Holothurian on 2018/10/20.
//  Copyright © 2018年 yinlong. All rights reserved.
//

#import "BaseBackViewController.h"

@interface BaseBackViewController ()

@end

@implementation BaseBackViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    if (!self.isPush) {
        self.navigationItem.leftBarButtonItem = nil;
    }else{
        UIView * leftBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
        
        UIImageView * leftImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 12, 21)];
        leftImageView.image = [UIImage imageNamed:@"backUp"];
        leftImageView.center = CGPointMake(6, leftBgView.bounds.size.height/2);
        leftImageView.userInteractionEnabled = YES;
        [leftBgView addSubview:leftImageView];
        
        UITapGestureRecognizer * backTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(backTapClick)];
        [leftBgView addGestureRecognizer:backTap];
        
        UIBarButtonItem * leftBtnItem = [[UIBarButtonItem alloc]initWithCustomView:leftBgView];
        self.navigationItem.leftBarButtonItem = leftBtnItem;
    }
}


- (void)backTapClick{
    [self.navigationController popViewControllerAnimated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
